{template 'common/header'}
<ul class="nav nav-tabs">
		<li class="active"><a href="{php echo $this->createWebUrl('notice', array('op' => 'list'));}">通知管理</a></li>
		<li><a href="{php echo $this->createWebUrl('notice', array('op' => 'add'));}">设置通知</a></li>
	</ul>
	<div style="padding:15px;">
		<table class="table table-hover table-bordered" >
			<thead class="navbar-inner">
				<tr>
					<th style="width:40px;">姓名</th>
					<th style="width:40px;">通知方式</th>
					<th style="width:40px;">报修是否启用</th>
					<th style="width:40px;">投诉是否启用</th>
					<th style="width:60px;">超市订单提醒是否启用</th>
					<th style="width:60px;">客户预约通知是否启用</th>
					<th style="width:40px;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td>{$item['realname']}</td>
					<td>{if $item['type'] == 1}模板消息通知 {elseif $item['type'] == 2} 短信通知{else} 全部通知{/if}</td>
					<td><input type="checkbox" name="repair_status" onclick="verify(this,{$item['id']},'repair_status')" data="{$item['repair_status']}" {if $item['repair_status'] == 2 }checked="checked"{/if}> 是</td>
					<td><input type="checkbox" name="report_status" onclick="verify(this,{$item['id']},'report_status')"data="{$item['report_status']}" {if $item['report_status'] == 2}checked="checked"{/if}> 是</td>
					<td><input type="checkbox" name="shopping_status" onclick="verify(this,{$item['id']},'shopping_status')" data="{$item['shopping_status']}" {if $item['shopping_status'] == 2 }checked="checked"{/if}> 是</td>
					<td><input type="checkbox" name="homemaking_status" onclick="verify(this,{$item['id']},'homemaking_status')" data="{$item['homemaking_status']}" {if $item['homemaking_status'] == 2 }checked="checked"{/if}> 是</td>
					<td>
						<a href="JavaScript:;" data="{$item['id']}" class="del_peo"><i class="fa fa-trash-o text-sg"></i> 删除微信 </a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
<script type="text/javascript">
 $(function () {
        $(".del_peo").bind("click",function(){
            var id = $(this).attr('data');
            // alert(id);
	        var url = "{php echo $this->createWebUrl('notice',array('op' => 'delete'))}";
	            $.post(url,
	            {
	                id:id
	            },
	            function(msg){
	                    if (msg.status == 1) {
	                    	setTimeout(function(){
	                        	window.location.reload();
	                   		 },100);
	                    };
	                    
	            },
	            'json');
        });
});
 function verify(obj, id, type) {
    $.post("{php echo $this->createWebUrl('notice',array('op' => 'verify'))}", {
        id: id,
        type: type,
        data: obj.getAttribute("data")
    }, function(d) {
    	if (d.data== 2) {
    		alert('已启用');
    	}else{
    		alert('已禁用');
    	}
        // if (type == 'status') {
        //     $(obj).html(d.data == '1' ? '启用' : '禁止');
        // }
        // $(obj).attr("data", d.data);

    }, "json");
}
</script>
{template 'common/footer'}